package com.example.domain.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import lombok.Data;

/**
 * 荔枝产区信息表，存储地理坐标及主栽品种
 * @TableName production_area
 */
@TableName(value ="production_area")
@Data
public class ProductionArea {
    /**
     * 主键，自增ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 产区名称（如：茂名高州、湛江徐闻）
     */
    private String areaName;

    /**
     * 所属城市（固定值：茂名/湛江/阳江/云浮）
     */
    private String city;

    /**
     * 经度（用于地图定位，如110.9255）
     */
    private BigDecimal longitude;

    /**
     * 纬度（用于地图定位，如21.6630）
     */
    private BigDecimal latitude;

    /**
     * 主栽品种ID（关联lychee_variety表id）
     */
    private Integer mainVarietyId;

    /**
     * 产区简要介绍（如种植历史、产量规模）
     */
    private String introduction;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ProductionArea other = (ProductionArea) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getAreaName() == null ? other.getAreaName() == null : this.getAreaName().equals(other.getAreaName()))
            && (this.getCity() == null ? other.getCity() == null : this.getCity().equals(other.getCity()))
            && (this.getLongitude() == null ? other.getLongitude() == null : this.getLongitude().equals(other.getLongitude()))
            && (this.getLatitude() == null ? other.getLatitude() == null : this.getLatitude().equals(other.getLatitude()))
            && (this.getMainVarietyId() == null ? other.getMainVarietyId() == null : this.getMainVarietyId().equals(other.getMainVarietyId()))
            && (this.getIntroduction() == null ? other.getIntroduction() == null : this.getIntroduction().equals(other.getIntroduction()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getAreaName() == null) ? 0 : getAreaName().hashCode());
        result = prime * result + ((getCity() == null) ? 0 : getCity().hashCode());
        result = prime * result + ((getLongitude() == null) ? 0 : getLongitude().hashCode());
        result = prime * result + ((getLatitude() == null) ? 0 : getLatitude().hashCode());
        result = prime * result + ((getMainVarietyId() == null) ? 0 : getMainVarietyId().hashCode());
        result = prime * result + ((getIntroduction() == null) ? 0 : getIntroduction().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", areaName=").append(areaName);
        sb.append(", city=").append(city);
        sb.append(", longitude=").append(longitude);
        sb.append(", latitude=").append(latitude);
        sb.append(", mainVarietyId=").append(mainVarietyId);
        sb.append(", introduction=").append(introduction);
        sb.append("]");
        return sb.toString();
    }
}